import Vue from 'vue'
import App from './App.vue'
import store from './store'
import router from './router'

import './permission'
import './assets/icons' // icon

// 字典标签组件
import DictTag from '@/components/DictTag'
// 字典数据组件
import DictData from '@/components/DictData'
// 分页组件
import Pagination from "@/components/Pagination"
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
// 科室树组件
import DeptTree from "@/components/Dept/deptTree"
// 机构树组件
import SysOrgTree from "@/components/SysOrgTree"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"

// plugins
import plugins from './plugins'
import Cookies from 'js-cookie'
import Element from 'element-ui'
// 指令 权限、字符串等
import directive from './directive'
import './assets/styles/element-variables.scss'
// global css
import '@/assets/styles/index.scss'
import "@/assets/styles/element-dense.scss"
import {parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree} from "@/utils/zpPlatform"
// 获取配置
import {getConfigKey, updateConfigByKey} from "@/api/system/config"

// 全局方法挂载
Vue.prototype.handleTree = handleTree
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.updateConfigByKey = updateConfigByKey


// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Pagination', Pagination)
Vue.component('DeptTree', DeptTree)
Vue.component('ImageUpload', ImageUpload)
Vue.component('SysOrgTree', SysOrgTree)

Vue.use(plugins)
Vue.use(directive)
DictData.install()

Vue.use(Element, {
    size: Cookies.get('size') || 'mini' // set element-ui default size
})

new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})
